var express = require('express');
var router = express.Router();
var orderModel = require('../../models/order/order_list');

//定义路由，当访问该路由的时候，去数据库查找信息并返回
router.post('/', function (req, res, next) {
    var params = req.body
    console.log(params)
    orderModel.create({
        note: params.note,
        openid: params.openid,
        picture: params.picture,
        price: params.price,
        task_time: params.task_time,
        title: params.title,
        type: params.type,
        publish_time: new Date(),
        state: 0,
        taker: null
    }, function (err, docs) {
        if (!err) {
            res.json({ data: null, msg: '添加成功！', code: 200 })
        }
    })
})

module.exports = router;
